{extend name="public:layout" /}
{block name="title"}添加{$moudleName}{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form" action="{:url('logic.query/infoRecord')}">
                <input class="form-control" type="hidden" name="mid" value="15" datatype="*" />
                <input class="form-control" type="hidden" name="uid" value="{$uid}" datatype="*" />
                <input class="form-control" type="hidden" placeholder="提交申请人" name="apply_uid" value="{$uid}" datatype="*" />
                <input class="form-control" type="hidden" name="car_id" value="{$Request.param.car_id}" datatype="*" />
                <input class="form-control" type="hidden" name="ser_start_time" value="{php}echo time();{/php}" datatype="*" />
                <input class="form-control" type="hidden" name="ser_end_time" value="{php}echo time();{/php}" datatype="*" />
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">车牌号</label>
                    <div class="col-sm-3">
                        <input class="form-control" type="text" name="car_sn" value="{$Request.param.car_sn}" datatype="*" readonly/>
                    </div>
                </div>
                <div class="form-group" style="display:none">
                    <label class="col-sm-2 control-label Validform_label">类别</label>
                    <div class="col-sm-3">
                        <label class="radio-inline i-checks">
                            <input type='radio' name="ser_type" value="0" checked/> 保养</label>
                        <label class="radio-inline i-checks"><input type='radio' name="ser_type"  value="1"/> 维修</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">维修工</label>
                    <div class="col-sm-8">
                        <input type="text" name="repair_uid" id="select-client" placeholder="请输入维修工姓名检索" datatype="*" data-init="" style="width:100%;" />
                        <script>
                            In('selectpage',function(){
                                $('#select-client').selectPage({
                                    keyField:'uid',
                                    showField:'name',
                                    multiple:false,
                                    pagination:true,
                                    dbTable:'user',
                                    data:'/plus/ajax/selectpage',
                                    andOr:'OR',
                                    params : function(){return {'searchField':'name'}},
                                    eAjaxSuccess : function(data){
                                        if(data.totalRow>0){
                                            return data;
                                        }else{
                                            return false;
                                        }
                                    },
                                });
                            })
                        </script>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">问题说明</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" placeholder="" name="title" value="" datatype="*" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">轮胎编码(左前)</label>
                    <div class="col-sm-3">
                        <input class="form-control" name="shoe1" value="{:get_field_value('car','shoe1',['car_sn'=>$Request.param.car_sn])}"/>
                    </div>
                    <label class="col-sm-2 control-label Validform_label">轮胎编码(右前)</label>
                    <div class="col-sm-3">
                        <input class="form-control" name="shoe2" value="{:get_field_value('car','shoe2',['car_sn'=>$Request.param.car_sn])}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">轮胎编码(左后)</label>
                    <div class="col-sm-3">
                        <input class="form-control" name="shoe3" value="{:get_field_value('car','shoe3',['car_sn'=>$Request.param.car_sn])}"/>
                    </div>
                    <label class="col-sm-2 control-label Validform_label">轮胎编码(右后)</label>
                    <div class="col-sm-3">
                        <input class="form-control" name="shoe4" value="{:get_field_value('car','shoe4',['car_sn'=>$Request.param.car_sn])}"/>
                    </div>
                </div>
                <div class="form-group" style="display:none;">
                    <label class="col-sm-2 control-label Validform_label">维修状态</label>
                    <div class="col-sm-4">
                        <label class="radio-inline i-checks"><input type='radio' name="service_status" value="0" /> 已提交</label>
                        <label class="radio-inline i-checks"><input type='radio' name="service_status" value="1" /> 开始处理</label>
                        <label class="radio-inline i-checks"><input type='radio' name="service_status" value="2" checked/> 处理完成</label>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary" id="btnSub" type="button">保存</button>
                        <a href="javascript:;" onclick="layer.closeAll()" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        iCheck();
        formatDate();
    });
    In('validform','layer',function(){
        $("#form").Validform({
            btnSubmit:'#btnSub',
            ajaxPost: true,
            postonce: true,
            tipSweep: true,
            callback: function (data) {
                if(data.code==1){
                    var car_data={
                        aid:"{$Request.param.car_id}",
                        mid:5,
                        shoe1:$('input[name="shoe1"]').val(),
                        shoe2:$('input[name="shoe2"]').val(),
                        shoe3:$('input[name="shoe3"]').val(),
                        shoe4:$('input[name="shoe4"]').val(),
                        is_update:1,
                        car_status:0,
                    }
                    $.post("{:url('logic.query/infoRecord')}",car_data,function (res) {
                        if(res.code==1){
                            layer.msg('轮胎信息已更新',{time:1000},function () {
                                top.layer.closeAll();
                                refresh();
                            })
                        }else{
                            layer.msg(res.msg);
                        }
                    })
                }else{
                    top.layer.msg(data.msg);
                }
            }
        });
    })

</script>
{/block}